#include "TCPPoint.h"

#include <iostream>
using std::cout;

int main()
{
	TCPPoint client;
	if (!client.Connect("192.168.245.1", 6789))
	{
		cout << "connect error: " << client.GetErrorMessage() << '\n';
		return -1;
	}

	cout << "Connected\n";

	char buf[] = "tcp point";
	Connection con = client.GetConnection();

	cout << "Connection info: \n" 
		<< "sock: " << con._sock << '\n'
		<< con.GetLocalIp() << ' ' << con.GetLocalPort() << '\n'
		<< con.GetRemoteIp() << ' ' << con.GetRemotePort() << '\n';


	if (con.Write(buf, 0, 9))
	{
		cout << "Send success\n";
	}
	else
	{
		cout << "write error: " << client.GetErrorMessage() << '\n';
	}
}